package com.qydp.rpc.server;

import io.vertx.core.Vertx;

/**
 * @author shuSheng
 * @description
 * @since 2024-07-16 10:01
 */
public class VertxHttpServer implements HttpServer {
    @Override
    public void doStart(int port) {
        Vertx vertx = Vertx.vertx();
        io.vertx.core.http.HttpServer httpServer = vertx.createHttpServer();
        httpServer.requestHandler(new HttpServerHandler());
        httpServer.listen(port, result -> {
            if (result.succeeded()) {
                System.out.println("http server started on port " + port);
            } else {
                System.out.println("http server start failed" + result.cause());
            }

        });
    }
}
